<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建文章</title>
    <link rel="stylesheet" href="static/css/reset.css">
    <link rel="stylesheet" href="static/css/base.css">
</head>
<body>

<div id="app">
    <div><a href="index.html">返回首页</a></div>
    <div>
        <label>请输入标题
            <input type="text">
        </label>
    </div>
    <div>
        <label>请输入内容
            <textarea cols="30" rows="10"></textarea>
        </label>
    </div>
    <div>
        <button class="btn btn-primary" @click="saveData">保存</button>
    </div>
</div>


<script src="static/js/FileSaver.js"></script>
<script src="static/js/vue.js"></script>
<script>
    let app = new Vue({
        el: '#app',
        data() {
            return {}
        },
        methods: {
            saveData() {
                console.log(123);
                let data = {
                    name: "hanmeimei",
                    age: 88
                }
                var content = JSON.stringify(data);
                var blob = new Blob([content], {type: "text/plain;charset=utf-8"});
                saveAs(blob, "save.json");
                alert('保存完成')
            }
        }
    })
</script>

</body>
</html>